import request from '@/utils/request'

// 所有角色列表
export function allRole() {
  return request({
    url: `/business_admin/role/all`,
    method: 'get'
  })
}

// 分页列表
export function listRole(data) {
  return request({
    url: `/business_admin/role/list`,
    method: 'post',
    data: data
  })
}

// 创建角色
export function addRole(data) {
  return request({
    url: `/business_admin/role/add`,
    method: 'post',
    data: data
  })
}

// 获取角色信息
export function getRole(roleId) {
  return request({
    url: `/business_admin/role/info`,
    method: 'get',
    params: { roleId }
  })
}

// 更新角色信息
export function updateRole(roleId, data) {
  data.id = roleId
  return request({
    url: `/business_admin/role/edit`,
    method: 'post',
    data: data
  })
}

// 删除角色updateResource
export function deleteRole(roleId) {
  return request({
    url: `/business_admin/role/delete`,
    method: 'post',
    params: { roleId }
  })
}

export function getRolePerms(roleId) {
  return request({
    url: `/business_admin/role/getRolePerms`,
    method: 'get',
    params: { roleId }
  })
}

export function updateRolePerms(data) {
  return request({
    url: `/business_admin/role/updateRolePerms`,
    method: 'post',
    data: data
  })
}
